<script>
import { mapState, mapActions } from 'vuex';
export default {
  name: "GrandchildComponent",

  computed: {
    ...mapState(['message']), // 通过 mapState 获取状态
  },
  methods: {
    ...mapActions(['updateMessageAsync']), // 通过 mapActions 映射 actions
  }
}
</script>

<template>
  <div>
    <h3>孙组件</h3>
    <p>从 Vuex 获取的状态: {{ message }}</p>
    <button @click="updateMessageAsync('来自孙组件的异步消息')">异步更新状态</button>
  </div>
</template>

<style scoped>

</style>
